#pragma once

//CF1777B Emordnilap

#include<iostream>
#include<cstring>
using namespace std;
using LL = long long;
template<const int T>
struct ModInt {
    const static int mod = T;
    int x;
    ModInt(int x = 0) : x(x% mod) {}
    ModInt(long long x) : x(int(x% mod)) {}
    int val() { return x; }
    ModInt operator + (const ModInt& a) const { int x0 = x + a.x; return ModInt(x0 < mod ? x0 : x0 - mod); }
    ModInt operator - (const ModInt& a) const { int x0 = x - a.x; return ModInt(x0 < 0 ? x0 + mod : x0); }
    ModInt operator * (const ModInt& a) const { return ModInt(1LL * x * a.x % mod); }
    ModInt operator / (const ModInt& a) const { return *this * a.inv(); }
    void operator += (const ModInt& a) { x += a.x; if (x >= mod) x -= mod; }
    void operator -= (const ModInt& a) { x -= a.x; if (x < 0) x += mod; }
    void operator *= (const ModInt& a) { x = 1LL * x * a.x % mod; }
    void operator /= (const ModInt& a) { *this = *this / a; }
    friend ostream& operator<<(ostream& os, const ModInt& a) { return os << a.x; }

    ModInt pow(int64_t n) const {
        ModInt res(1), mul(x);
        while (n) {
            if (n & 1) res *= mul;
            mul *= mul;
            n >>= 1;
        }
        return res;
    }

    ModInt inv() const {
        int a = x, b = mod, u = 1, v = 0;
        while (b) {
            int t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        if (u < 0) u += mod;
        return u;
    }

};
typedef ModInt<1000000007> mint;

const int maxn = 1e5 + 5;
mint fact[maxn];

int main() {

    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(0);

    fact[0] = 1;
    for (int i = 1; i < maxn; i++) fact[i] = fact[i - 1] * i;

    int T;
    cin >> T;
    while (T--) {
        int n;
        cin >> n;
        cout << fact[n] * mint(n) * mint(n - 1) << '\n';
    }

}
